import fs from 'fs';
import {NextResponse} from "next/server";

export async function POST(request: Request) {

    const {outputDir} = await request.json();

    console.log(outputDir)

    const filenames = fs.readdirSync(outputDir);

    const images = filenames.map((filename) => ({
        filename,
        url: `/images/${filename}`,
    }));

    return NextResponse.json({message: 'images', images});
}